package com.billiards.dao;

import com.billiards.entity.Ball;
import com.billiards.entity.BallAppt;
import org.apache.ibatis.annotations.*;

import java.util.List;
@Mapper
public interface BallMapper {
    @Select("select * from ball_information")
    public List<Ball> getBallList();

    @Select("select * from ball_information  where ballname like concat('%',#{ballname},'%')")
    public List<Ball> getBallballname(String ballname);




    @Update("update ball_information set state=#{state},buytime=#{buytime} ,image=#{image},broken=#{broken} where id=#{id}")
    public int updateBall(Ball ball);

    @Insert(" insert into ball_information(id, ballname,state, buytime, broken,image)values (null,#{ballname},#{state},#{buytime},#{broken},#{image})")
    public int addball(Ball ball);

    @Delete("delete from ball_information where id=#{delId}")
    public int deleteBall(Integer delId);

    //查找已预约
    @Select("Select * from ball_information  where state='已预约' " )
    List<Ball> getYesBallState(String state);


    //    查找未预约
    @Select("Select * from ball_information  where state='未预约' " )
    List<Ball> getNoBallState(String state);


}
